package com.lgs.demo.base;

import android.content.Context;
import android.view.View;

import butterknife.ButterKnife;

/**
 * Created by lgs on 2018/3/10.
 */

public abstract class BaseHolder<ITEMBEAN> {

    public View view;
    protected ITEMBEAN item;
    protected Context mContext;

    public BaseHolder(Context context) {
        this.mContext = context;
        view = View.inflate(context, getLayoutId(), null);
        ButterKnife.bind(this, view);
        view.setTag(this);
    }

    /**
     * 获取条目布局id
     *
     * @return
     */
    protected abstract int getLayoutId();

    /**
     * 获取条目bean  刷新条目view
     *
     * @param item
     */
    public void setDataAndRefreshView(ITEMBEAN item) {
        this.item = item;
        refreshView();
    }

    /**
     * view+data
     */
    protected abstract void refreshView();
}
